import time
from selenium import webdriver
from selenium.webdriver.common.by import By

# 打开浏览器
driver = webdriver.Chrome()

#打开网站
driver.get('https://ecshop.test2.shopex123.com/')

time.sleep(2)

# 用class定义免费注册
driver.find_element(By.CLASS_NAME,'reg').click()

# 用class定义用户注册
driver.find_element(By.CLASS_NAME,'f_input').send_keys('陈浩南')

# 用id定义邮箱

time.sleep(2)
driver.find_element(By.ID,'email').send_keys('1806807989@qq.com')

# 用id定义密码
time.sleep(2)
driver.find_element(By.ID,'password1').send_keys('www.4399.com')

#用id定义确认密码
time.sleep(2)
driver.find_element(By.ID,'confirm_password').send_keys('www.4399.com')

# 用name定义同意协议注册
time.sleep(2)
driver.find_element(By.NAME,'Submit').click()
#回退操作
driver.back()

#用class定义登陆
time.sleep(2)
driver.find_element(By.CLASS_NAME,'sign').click()

# 用name定义登录账号操作
time.sleep(2)
driver.find_element(By.NAME,'username').send_keys('陈浩南')

# 用name定义登录密码操作
time.sleep(2)
driver.find_element(By.NAME,'password').send_keys('www.4399.com')

#用name定义保存登录信息
time.sleep(2)
driver.find_element(By.NAME,'remember').click()

#用 name 定义登录
time.sleep(2)
driver.find_element(By.NAME,'submit').click()

# 退出浏览器
time.sleep(5)
driver.quit()





